import request from '@/config/axios'

export interface PageParam {
  id?: string // 商户id
  name?: string // 商户名称
  mobile?: string // 手机号
  shopName?:string // 店铺名称
  status?:number // 商户状态：0-正常，1-禁用
  createTime?:string[] // 设备创建时间mac
  pageNo:number // 页码，从 1 开始
  pageSize:number // 每页条数，最大值为 100
}

export interface MerchantVo{
  id?: string, //商户id
  name: string, //商户名称
  mobile: string, //手机号
  shopName: string, //店铺名称
  shopAddress: string, //店铺位置
  businessHours: string, //营业时间
  status: string //商户状态：0-正常，1-禁用
}
export interface MerchantUserVo{
systemUserId: number,merchantId:string
}
// 获得列表
export const getMerchantPage = (params: PageParam) => {
  return request.get({ url: '/merchant/user/page', params })
}
// 获得详情
export const getMerchantById = (id: string) => {
  return request.get({ url: `/merchant/user/get?id=${id}` })
}
// 获得详情
export const getMerchantByIds = (ids: string[]) => {
  return request.get({ url: `/merchant/user/getList?ids=${ids}` })
}
// 创建任务
export const createMerchant = (data: MerchantVo) => {
  return request.post({ url: '/merchant/user/create', data })
}
// 更新任务
export const updateMerchant = (data: MerchantVo) => {
  return request.put({ url: '/merchant/user/update', data })
}

// 删除任务
export const deleteMerchantById = (id: number) => {
  return request.delete({ url: `/merchant/user/delete?id=${id}` })
}
// 用户绑定商户
export const bindMerchantToUser = (data:MerchantUserVo) => {
  return request.put({ url: `/system/user/bind-merchant-admin?systemUserId=${data.systemUserId}&merchantId=${data.merchantId}` })
}


